package com.itcm.dynamicdata.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.itcm.dynamicdata.entity.User;
import com.itcm.dynamicdata.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述:
 *
 * @author cm_fighting
 * @create 2021-01-07 6:11 下午
 */
@Service
public class UserService {

    @Autowired
    UserMapper userMapper;

    @DS("master")
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    @DS("slave")
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }
}
